package top.zhangjianyong.tools.controller;

import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import top.zhangjianyong.tools.entity.stock.StockUser;
import top.zhangjianyong.tools.parm.stock.StockUserGoodsBorrowListParam;
import top.zhangjianyong.tools.parm.stock.StockUserGoodsBorrowParam;
import top.zhangjianyong.tools.service.api.StockUserGoodsService;
import top.zhangjianyong.tools.user.VerifyUser;
import top.zhangjianyong.tools.utils.ApiResponse;

/**
 * @author zhangjianyong
 * @since 2025/4/1 下午4:31
 */
@VerifyUser(user = StockUser.class)
@RestController
@RequestMapping("/stock/user/goods")
public class StockUserGoodsController {


    private final StockUserGoodsService stockUserGoodsService;

    public StockUserGoodsController(StockUserGoodsService stockUserGoodsService) {
        this.stockUserGoodsService = stockUserGoodsService;
    }

    @PostMapping("/borrowReturn")
    public ApiResponse borrowReturn(@RequestBody @Validated StockUserGoodsBorrowParam param) {
        return stockUserGoodsService.borrowReturn(param);
    }

    @PostMapping("/borrow/list")
    public ApiResponse borrowList(StockUserGoodsBorrowListParam param) {
        return stockUserGoodsService.borrowList(param);
    }

}
